<?php
/**
 * Created by PhpStorm.
 * User: Yueool
 * Date: 2018/8/10
 * Time: 12:30
 */

namespace common\models;

use Yii;


class Knowledge{


    /**
     * 遍历数据表
     */
    public static function trav($cb){
        $db = Yii::$app->db;
        $sql = "SELECT k.* FROM {{%knowledge}} as k";
        $knowledges = $db->createCommand($sql)->queryAll();

        //print_r($knowledges);
        foreach($knowledges as $knowledge){
            $cb($knowledge);
        }
    }

}